home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1122
/
1122.xpi
/
chrome
/
tabmixplus.jar
/
content
/
tabmixplus
/
extensions
/
wizzrss.js
< prev
next >
Wrap
Text File
|
2009-09-02
|
3KB
|
114 lines
// code by onemen
// Look for RSS/Atom News Reader
function TMP_LookForRSS()
{
if ("gotoLink" in window)
TMP_wizzrss.init();
if ("openNewsfox" in window)
TMP_Newsfox.init();
if ("RSSTICKER" in window)
TMP_RSSTICKER.init();
}
var TMP_RSSTICKER = {
init : function ()
{
eval("RSSTICKER.writeFeed ="+RSSTICKER.writeFeed.toString().replace(
'tbb.setAttribute("onclick"',
'tbb.setAttribute("onclick", "this.onClick(event);");\
tbb.setAttribute("_onclick"'
).replace(
'tbb.onContextOpen =',
'tbb.onContextOpen = TMP_RSSTICKER.onContextOpen; \
tbb.onClick = TMP_RSSTICKER.onClick; \
tbb._onContextOpen ='
));
},
onClick : function (event) {
if (event.ctrlKey) {
this.markAsRead(true);
}
else if ((this.parent.alwaysOpenInNewTab && (event.which == 1)) || (event.which == 2)) {
this.onContextOpen("tab");
}
else if (event.which == 1) {
this.onContextOpen();
}
},
onContextOpen : function (target) {
if (!target) {
if (TMP_whereToOpen(null).lock)
this.parent.browser.openInNewTab(this.href);
else
window._content.document.location.href = this.href;
}
else if (target == "window") {
if (gSingleWindowMode)
this.parent.browser.openInNewTab(this.href);
else
window.open(this.href);
}
else if (target == "tab") {
this.parent.browser.openInNewTab(this.href);
}
this.markAsRead();
}
}
// prevent Wizz RSS from load pages in locked tabs
var TMP_wizzrss =
{
init : function ()
{
var codeToReplace = /getContentBrowser\(\).loadURI|contentBrowser.loadURI/;
const newCode = "TMP_wizzrss.openURI";
var _functions = ["addFeedbase","validate","gohome","tryagain","promptStuff","promptStuff",
"doSearch","viewLog","renderItem","playEnc","renderAllEnc","playAllEnc",
"gotoLink","gotoLink","itemLinkClick","itemLinkClick","itemListClick"];
_functions.forEach(
function(_function) {
if (_function in window)
eval("window." + _function + " ="+ window[_function].toString()
.replace(codeToReplace,newCode));
}
);
},
openURI : function (uri)
{
var w = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
// we get here from other extension use getBrowser() for Firefox 3.0
var tabBrowser = w.getBrowser();
var openNewTab = w.TMP_whereToOpen(true).lock;
if (openNewTab) {
var newTab = tabBrowser.addTab(uri);
var theBGPref = !readPref("WizzRSSFocusTab", false, 2);
tabBrowser.TMP_selectNewForegroundTab(newTab, theBGPref);
}
else
tabBrowser.loadURI(uri);
}
}
// prevent Newsfox from load pages in locked tabs
var TMP_Newsfox =
{
init : function ()
{
eval("openNewsfox ="+openNewsfox.toString().replace(
'if (newTab) {',
'newTab = newTab || TMP_whereToOpen(null).lock; \ $&'
));
}
}